package com.wushi.lenovo.asia5b.app_model.good;

import com.mvp.base.model.BaseModel;
import com.wushi.lenovo.asia5b.app_model.good.goodbean.GoodsModel;

import java.util.List;

/**
 * Created by zhangyuncai on 2020/3/10.
 */
public class ShopModel extends BaseModel {
    public String shop_id;
    public String shop_name;
    public double total;//不带货币单位的店铺商品总价
    public String total_text;//带货币单位的店铺商品总价
    public double domestic_fee;//不带货币单位的店铺物流总价
    public String domestic_fee_text;//带货币单位的店铺物流总价
    public List<GoodsModel> products;


    public boolean isChecked() {
        boolean isChecked = true;
        if (products != null) {
            for (GoodsModel goodsModel : products) {
                if (isChecked) {
                    /*
                    只要有一个没有被选中,那就是没有被选中
                     */
                    if (!goodsModel.isChecked()&&goodsModel.canCheck()) {
                        return false;
                    }
                }
            }
        }
        return isChecked;
    }

    public void setChecked(boolean isChecked) {
        if (products != null) {
            for (GoodsModel goodsModel : products) {
                goodsModel.setChecked(isChecked);
            }
        }
    }
}

/*
 "result": 1,
 "data": {
     "charges": [
         {
             "code": "subtotal",
             "title": "Subtotal",
             "default_title": "Subtotal",
             "value": "12565.56",
             "rate": 0,
             "rate_type": 0,
             "max_fee": 0,
             "min_fee": 0,
             "paid_price_different_list": [],
             "different_amount": 0,
             "tooltips": "Total amount of the selected product\\'s price",
             "default_tooltips": "Total amount of the selected product\\'s pri
             "formula": "Total amount of the selected product\\'s price",
             "default_formula": "Total amount of the selected product\\'s pric
             "text": "RM 12,565.56",
             "sort_order": "1"
         },
         {
             "code": "total",
             "title": "Total",
             "default_title": "Total",
             "value": "12565.56",
             "tooltips": "",
             "default_tooltips": "",
             "rate": 0,
             "rate_type": 0,
             "max_fee": 0,
             "paid_price_different_list": [],
             "different_amount": 0,
             "min_fee": 0,
             "formula": "",
             "default_formula": "",
             "text": "RM 12,565.56",
             "sort_order": "99"
         }
     ],
     "language_id": 1,
     "total_weight": 0,
     "total_weight_before": 0,
     "total_local_weight": 0,
     "weights": [],
     "extra_data": {
         "voucher": "newmember1111"
     },
     "pack_weight": [],
     "is_sensitive": 0,
     "total_different": 0,
     "insurance_different_total": 0,
     "processing_different_total": 0,
     "got_pending_purchase": 0,
     "currency_code": "MYR",
     "subtotal": 12565.56,
     "type": "marketplace",
     "country_id": "4",
     "member_id": "5378",
     "confirm_order": "1",
     "total": 12565.56,
     "total_text": "RM 12,565.56",
     "paid_price_different_list": [],
     "payment_type": "marketplace",
     "first_payment": 1,
     "checkout_log_id": 18501,
     "shops": [
         {
             "shop_id": "34",
             "shop_name": "明成北",
             "total": 11368.199999999999,
             "total_text": "RM 11,368.20",
             "domestic_fee": 0,
             "domestic_fee_text": "RM 0.00",
             "products": [
                 {
                     "total_plus_domestic": "RM 3,418.20",
                     "total_value": "3418.20",
                     "group_domestic_fee_seller": 0,
                     "group_domestic_fee": 0,
                     "group_domestic_fee_format": "",
                     "is_sensitive": 1,
                     "price_value": 3418.2,
                     "type": "pending_payment",
                     "order_time": "",
                     "pay_different_type": "",
                     "order_id": 0,
                     "dimension_weight": 19.829333333333334,
                     "insurance_amount": 0,
                     "status": 5,
                     "id": 153006,
                     "product_id": 446734,
                     "quantity": 1,
                     "mp_product_id": "8537",
                     "stock_enough": 1,
                     "sku_id": "25590",
                     "weight": 0,
                     "sku_stock": "9999",
                     "dg_or_mp": "mp",
                     "brand": null,
                     "sensitive_cat_id": 6,
                     "category_id": 669,
                     "shop_id": "34",
                     "shop_name": "明成北",
                     "attr_name": "Set C (1 set = 180 pieces)",
                     "china_attr_name": "套组C （1套=180件）",
                     "width": "44",
                     "length": "52",
                     "height": "52",
                     "selected_weight": "19.82",
                     "highest_weight": "19.82",
                     "actual_weight": "1.00",
                     "m3_weight": 0.12,
                     "average_weight": "10.41",
                     "weight_method": "highest",
                     "weight_multiply": "1.0",
                     "size_dimension": 118976,
                     "total_size_dimension": 118976,
                     "total_dimension_weight": 19.829333333333334,
                     "kgorm3": "kg",
                     "option": "2737:10576",
                     "remark": null,
                     "cart_time": "2020-03-09 15:50:14",
                     "name": "Exquisite glass set",
                     "ori_name": "精美玻璃杯套组",
                     "eng_name": "Exquisite glass set",
                     "china_name": "精美玻璃杯套组",
                     "original_price": "31.90",
                     "converted_price": 3418.2,
                     "domestic_fee_ori": "0.00",
                     "domestic_fee_format": "",
                     "domestic_fee": 0,
                     "price_jawa": "RM 18.99",
                     "unit": "RM",
                     "price": "RM 3,418.20",
                     "shipping": 1,
                     "original_total": "31.90",
                     "converted_total": "3418.20",
                     "total": "3418.20",
                     "total_text": "RM 3,418.20",
                     "total_text_jawa": "RM 18.99",
                     "goods_attr": "eJzdlt9u2jAUxl8F5Wq7Cf4TJ7bRLpIMpF5sqsQDRF
                     "goods_attr_china": "eJzdlktu2zAQhq9S6AAy3yJpdCG5NpBFiwI5
                     "url": "",
                     "image": "http:\/\/47.88.173.86:82\/testShopImg\/20200309
                     "domestic_fee_seller": 0
                 },
                 {
                     "total_plus_domestic": "RM 4,077.00",
                     "total_value": "4077.00",
                     "group_domestic_fee_seller": 0,
                     "group_domestic_fee": 0,
                     "group_domestic_fee_format": "",
                     "is_sensitive": 1,
                     "price_value": 4076.9999999999995,
                     "type": "pending_payment",
                     "order_time": "",
                     "pay_different_type": "",
                     "order_id": 0,
                     "dimension_weight": 19.829333333333334,
                     "insurance_amount": 0,
                     "status": 5,
                     "id": 153005,
                     "product_id": 446734,
                     "quantity": 1,
                     "mp_product_id": "8537",
                     "stock_enough": 1,
                     "sku_id": "25589",
                     "weight": 0,
                     "sku_stock": "9999",
                     "dg_or_mp": "mp",
                     "brand": null,
                     "sensitive_cat_id": 6,
                     "category_id": 669,
                     "shop_id": "34",
                     "shop_name": "明成北",
                     "attr_name": "Set B (1 set = 150 pieces)",
                     "china_attr_name": "套组B （1套=150件）",
                     "width": "44",
                     "length": "52",
                     "height": "52",
                     "selected_weight": "19.82",
                     "highest_weight": "19.82",
                     "actual_weight": "1.46",
                     "m3_weight": 0.12,
                     "average_weight": "10.64",
                     "weight_method": "highest",
                     "weight_multiply": "1.0",
                     "size_dimension": 118976,
                     "total_size_dimension": 118976,
                     "total_dimension_weight": 19.829333333333334,
                     "kgorm3": "kg",
                     "option": "2737:10575",
                     "remark": null,
                     "cart_time": "2020-03-09 15:50:11",
                     "name": "Exquisite glass set",
                     "ori_name": "精美玻璃杯套组",
                     "eng_name": "Exquisite glass set",
                     "china_name": "精美玻璃杯套组",
                     "original_price": "38.05",
                     "converted_price": 4076.9999999999995,
                     "domestic_fee_ori": "0.00",
                     "domestic_fee_format": "RM 0.00",
                     "domestic_fee": 0,
                     "price_jawa": "RM 22.65",
                     "unit": "RM",
                     "price": "RM 4,077.00",
                     "shipping": 1,
                     "original_total": "38.05",
                     "converted_total": "4077.00",
                     "total": "4077.00",
                     "total_text": "RM 4,077.00",
                     "total_text_jawa": "RM 22.65",
                     "goods_attr": "eJzdlt9u2jAUxl8F5Wq7Cf4TJ7bRLpIMpF5sqsQDRF
                     "goods_attr_china": "eJzdlktu2zAQhq9S6AAy3yJpdCG5NpBFiwI5
                     "url": "",
                     "image": "http:\/\/47.88.173.86:82\/testShopImg\/20200309
                     "domestic_fee_seller": 0
                 },
                 {
                     "total_plus_domestic": "RM 3,535.20",
                     "total_value": "3535.20",
                     "group_domestic_fee_seller": 0,
                     "group_domestic_fee": 0,
                     "group_domestic_fee_format": "",
                     "is_sensitive": 1,
                     "price_value": 3535.2000000000003,
                     "type": "pending_payment",
                     "order_time": "",
                     "pay_different_type": "",
                     "order_id": 0,
                     "dimension_weight": 19.829333333333334,
                     "insurance_amount": 0,
                     "status": 5,
                     "id": 153004,
                     "product_id": 446734,
                     "quantity": 1,
                     "mp_product_id": "8537",
                     "stock_enough": 1,
                     "sku_id": "25588",
                     "weight": 0,
                     "sku_stock": "9999",
                     "dg_or_mp": "mp",
                     "brand": null,
                     "sensitive_cat_id": 6,
                     "category_id": 669,
                     "shop_id": "34",
                     "shop_name": "明成北",
                     "attr_name": "Set A (1 set = 120 pieces)",
                     "china_attr_name": "套组A （1套=120件）",
                     "width": "44",
                     "length": "52",
                     "height": "52",
                     "selected_weight": "19.82",
                     "highest_weight": "19.82",
                     "actual_weight": "1.65",
                     "m3_weight": 0.12,
                     "average_weight": "10.73",
                     "weight_method": "highest",
                     "weight_multiply": "1.0",
                     "size_dimension": 118976,
                     "total_size_dimension": 118976,
                     "total_dimension_weight": 19.829333333333334,
 */
